<template>
  <div class="viewFramework">
    <topbar></topbar>
    <div class="viewFrame-content">
      <sidebar></sidebar>
      <transition name="fade-left" appear>
      <div :class="collapse?'content-collapse':'section-content'">
        <v-tags></v-tags>
        <breadcrumb></breadcrumb>
        <main class="section-main">
          <router-view></router-view>
        </main>
        <footbar></footbar>
      </div>
      </transition>
    </div>
  </div>
</template>
<script>
import topbar from "../components/nav/topbar/topbar.vue";
import sidebar from "../components/nav/siderbar/sidebar.vue";
import breadcrumb from "../components/nav/breadcrumb.vue";
import footbar from "../components/footer/footer.vue";
import bus from '../components/bus.js';
import vTags from '../components/Tags.vue';
export default {
  data() {
      return {
          collapse: false
      };
    },
  components: {
    topbar,
    sidebar,
    footbar,
    breadcrumb,
    vTags
  },
  created(){
      bus.$on('collapse-content', msg => {
            this.collapse = msg;
      });
      // 只有在标签页列表里的页面才使用keep-alive，即关闭标签之后就不保存到内存中了。
        bus.$on('tags', msg => {
            let arr = [];
            for (let i = 0, len = msg.length; i < len; i++) {
                msg[i].name && arr.push(msg[i].name);
            }
            this.tagsList = arr;
        });
  }
};
</script>
<style scoped>
::-webkit-scrollbar{
  display: none !important;
}
.viewFramework {
    height: 100%;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.viewFrame-content {
    flex: 1;
    height: 100%;   
    display: flex;
}
.section-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: absolute;
    right: 0;
    bottom: 0;
    left: 240px;
    top: 70px;
    transition: all .3s linear;
}
.content-collapse {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: absolute;
    right: 0;
    bottom: 0;
    left: 64px;
    top: 70px;
    transition: all .3s linear;
}
.section-main {
    flex: 1;
    overflow-y: auto;
}
.fade-left-enter-active{
    animation: fade-left .3s;
}
.fade-left-leave-active{
    animation: fade-left .3s reverse;
}
@keyframes fade-left{
    from{opacity: 0;transform: translateX(-100px);}
    to{opacity: 1;transform: translateX(0px);}
}

</style>